//
//  SettingCell.m
//  Youhu
//
//  Created by Eton on 2016/11/9.
//  Copyright © 2016年 ApeStar. All rights reserved.
//

#import "SettingCell.h"
#import "SettingViewController.h"

@implementation SettingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(SettingModel *)model{
    _model = model;
    
    self.titleLabel.text = model.title;
    
    self.desLabel.text = model.detail;
    
    self.subLabel.text = model.subTitle;
    
    self.onSwitch.hidden = !model.showSwitch;
    
    self.onSwitch.on = model.switchOn;
    
    self.accessoryImageView.hidden = !model.showAccess;
    
}

- (IBAction)switchAction:(UISwitch *)sender {
    if ([self.model.title isEqualToString:SettingTableName_Push]){
        if ([self.delegate respondsToSelector:@selector(selectMessagePush:)]) {
            [self.delegate selectMessagePush:sender.on];
        }
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
